package com.yuhanginfo.common.utils;

/**
 * @author wanye
 * @date Dec 14, 2008
 * @version v 1.0
 * @description 得到当前应用的系统路径
 */
public class SystemPath {

	private static final String FILE_SEPARATOR = "file.separator";
	private SystemPath(){}
	public static String getSysPath() {
		String path = Thread.currentThread().getContextClassLoader()
				.getResource("").toString();
		String temp = path.replaceFirst("file:/", "").replaceFirst(
				"WEB-INF/classes/", "");
		String separator = System.getProperty(FILE_SEPARATOR);
		return temp.replaceAll("/", separator + separator);
	}

	public static String getClassPath() {
		String path = Thread.currentThread().getContextClassLoader()
				.getResource("").toString();
		String temp = path.replaceFirst("file:/", "");
		String separator = System.getProperty(FILE_SEPARATOR);
		return temp.replaceAll("/", separator + separator);
	}

	public static String getSystempPath() {
		return System.getProperty("java.io.tmpdir");
	}

	public static String getSeparator() {
		return System.getProperty(FILE_SEPARATOR);
	}

}
